<html>
<head><meta charset="utf-8"><title>Review quick rental replacement · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html">Review quick rental replacement</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205054735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205054735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205054735">(Jul 26 2020 at 14:43)</a>:</h4>
<p>Given that <code>rental</code> is no longer maintained I tried to make a replacement that is specific to my use case. Is it sound?</p>
<div class="spoiler-block"><div class="spoiler-header">

<p>The code</p>
</div><div class="spoiler-content" aria-hidden="true">

<div class="codehilite"><pre><span></span><code><span class="k">mod</span> <span class="nn">inner</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">use</span><span class="w"> </span><span class="k">super</span>::<span class="o">*</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">mem</span>::<span class="p">{</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">ManuallyDrop</span><span class="p">};</span><span class="w"></span>

<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Dwarf</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">mmap</span>: <span class="o">*</span><span class="k">mut</span><span class="w"> </span><span class="n">memmap</span>::<span class="n">Mmap</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">parsed</span>: <span class="nc">ManuallyDrop</span><span class="o">&lt;</span><span class="n">ParsedDwarf</span><span class="o">&lt;</span><span class="nb">&#39;static</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="k">impl</span><span class="w"> </span><span class="n">Dwarf</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">new</span><span class="p">(</span><span class="n">path</span>: <span class="kp">&amp;</span><span class="kt">str</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Result</span><span class="o">&lt;</span><span class="n">Dwarf</span><span class="p">,</span><span class="w"> </span><span class="nb">Box</span><span class="o">&lt;</span><span class="k">dyn</span><span class="w"> </span><span class="n">std</span>::<span class="n">error</span>::<span class="n">Error</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// Load ELF/Mach-O object file</span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">file</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">File</span>::<span class="n">open</span><span class="p">(</span><span class="n">path</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"></span>

<span class="w">            </span><span class="c1">// Safety: Not really, this assumes that the backing file will not be truncated or</span>
<span class="w">            </span><span class="c1">// written to while it is used by us.</span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">mmap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Box</span>::<span class="n">into_raw</span><span class="p">(</span><span class="nb">Box</span>::<span class="n">new</span><span class="p">(</span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">memmap</span>::<span class="n">Mmap</span>::<span class="n">map</span><span class="p">(</span><span class="o">&amp;</span><span class="n">file</span><span class="p">)</span><span class="o">?</span><span class="w"> </span><span class="p">}));</span><span class="w"></span>

<span class="w">            </span><span class="c1">// Safety: `mmap` is not deallocated or changed before `parsed` is.</span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">parsed</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ManuallyDrop</span>::<span class="n">new</span><span class="p">(</span><span class="n">ParsedDwarf</span>::<span class="n">new</span><span class="p">(</span><span class="w"></span>
<span class="w">                </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;**</span><span class="n">mmap</span><span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="w">            </span><span class="p">)</span><span class="o">?</span><span class="p">);</span><span class="w"></span>

<span class="w">            </span><span class="c1">// Safety: No reference to `parsed` can be obtained without the lifetime being shortened</span>
<span class="w">            </span><span class="c1">// to be smaller than the `Dwarf` that contains both `parsed` and the `mmap` it borrows</span>
<span class="w">            </span><span class="c1">// from.</span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">parsed</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">mem</span>::<span class="n">transmute</span>::<span class="o">&lt;</span><span class="n">ManuallyDrop</span><span class="o">&lt;</span><span class="n">ParsedDwarf</span><span class="o">&lt;</span><span class="nb">&#39;_</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">ManuallyDrop</span><span class="o">&lt;</span><span class="n">ParsedDwarf</span><span class="o">&lt;</span><span class="nb">&#39;static</span><span class="o">&gt;&gt;&gt;</span><span class="p">(</span><span class="n">parsed</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">};</span><span class="w"></span>

<span class="w">            </span><span class="nb">Ok</span><span class="p">(</span><span class="n">Dwarf</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">mmap</span><span class="p">,</span><span class="w"> </span><span class="n">parsed</span><span class="w"> </span><span class="p">})</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>

<span class="w">        </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">rent</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">f</span>: <span class="nc">impl</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">FnOnce</span><span class="p">(</span><span class="o">&amp;</span><span class="n">ParsedDwarf</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">f</span><span class="p">(</span><span class="o">&amp;*</span><span class="bp">self</span><span class="p">.</span><span class="n">parsed</span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="k">impl</span><span class="w"> </span><span class="nb">Drop</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Dwarf</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">fn</span> <span class="nf">drop</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">ManuallyDrop</span>::<span class="nb">drop</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">parsed</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="nb">Box</span>::<span class="n">from_raw</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">mmap</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


</div></div>



<a name="205056145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056145">(Jul 26 2020 at 15:27)</a>:</h4>
<p>If you’re not mutating, I think you don’t even need <code>rent</code>; you should be able to get away with <code>fn parsed&lt;'a&gt;(&amp;'a self) -&gt; &amp;'a ParsedDwarf&lt;'a&gt;</code>…</p>



<a name="205056238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056238">(Jul 26 2020 at 15:29)</a>:</h4>
<p>I may add internal mutability for caching lazily computed data.</p>



<a name="205056293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056293">(Jul 26 2020 at 15:30)</a>:</h4>
<p>Also, you probably don’t need to store <code>Mmap</code> behind a pointer, since it’s already a pointer type itself (i.e. the data is stored externally, not within the <code>Mmap</code> object itself)</p>



<a name="205056306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056306">(Jul 26 2020 at 15:31)</a>:</h4>
<p>I see</p>



<a name="205056328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056328">(Jul 26 2020 at 15:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="198590">comex</span> <a href="#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement/near/205056293">said</a>:</p>
<blockquote>
<p>Also, you probably don’t need to store <code>Mmap</code> behind a pointer, since it’s already a pointer type itself (i.e. the data is stored externally, not within the <code>Mmap</code> object itself)</p>
</blockquote>
<p>indeed, now storing it directly</p>



<a name="205056384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056384">(Jul 26 2020 at 15:33)</a>:</h4>
<p>Really a shame that <code>rental</code> is no longer maintained.  Maybe I should maintain it.</p>



<a name="205056390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056390">(Jul 26 2020 at 15:33)</a>:</h4>
<p>I’m not a good maintainer though; I tend to be unreliable</p>



<a name="205056447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205056447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205056447">(Jul 26 2020 at 15:35)</a>:</h4>
<p>Yeah, I was surprised that <code>rental</code> is no longer maintained. <span class="user-mention silent" data-user-id="210946">Nikita Baksalyar</span> notified me of it when submitting a PR using it.</p>



<a name="205061313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205061313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205061313">(Jul 26 2020 at 18:02)</a>:</h4>
<p><span class="user-mention" data-user-id="198590">@comex</span> If you're more interested in a one-off effort than a long-term maintenance task, I'd love to see an MCP and project group proposal for "teach the borrow checker how to handle self-borrows".</p>



<a name="205062538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062538">(Jul 26 2020 at 18:40)</a>:</h4>
<p>I'd absolutely love that, but it's also very hard :)</p>



<a name="205062549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062549">(Jul 26 2020 at 18:40)</a>:</h4>
<p>I could help with specing it out, but I think most of the work is in implementing it.</p>



<a name="205062579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062579">(Jul 26 2020 at 18:41)</a>:</h4>
<p>Specifying it isn't trivial either.</p>



<a name="205062626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062626">(Jul 26 2020 at 18:42)</a>:</h4>
<p>But I was also trying to talk you into helping to implement it, on the theory that that would be much more fun than maintaining <code>rental</code>. ;)</p>



<a name="205062629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062629">(Jul 26 2020 at 18:42)</a>:</h4>
<p>Probably!  Don't know if I have enough time to work on a project like that though.</p>



<a name="205062636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062636">(Jul 26 2020 at 18:43)</a>:</h4>
<p>I get the impression that, once the spec is nailed down, it'll be much easier to implement things like that with <code>chalk</code> in place.</p>



<a name="205062690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062690">(Jul 26 2020 at 18:44)</a>:</h4>
<p>Not with polonius?</p>



<a name="205062721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062721">(Jul 26 2020 at 18:45)</a>:</h4>
<p>It's interesting because it implies some form of "path-dependent types" like Scala has.  Like, if you have <code>array: [StructWithSelfBorrows; 2]</code>, <code>array[0]</code> and <code>array[1]</code> have the same type, but they're not equivalent - you can't necessarily swap a struct field between one and the other (if the field has self-references).</p>



<a name="205062780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062780">(Jul 26 2020 at 18:47)</a>:</h4>
<p>I should say, if the field has references to other parts of the struct.</p>



<a name="205062834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062834">(Jul 26 2020 at 18:49)</a>:</h4>
<p>I suppose this could also be a pathway to something nicer than <code>Pin</code>...</p>



<a name="205062924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062924">(Jul 26 2020 at 18:50)</a>:</h4>
<p>Although that would additionally require a notion of immovability.</p>



<a name="205062991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205062991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205062991">(Jul 26 2020 at 18:53)</a>:</h4>
<p>But even for a <code>rental</code> replacement you need either a notion of stable-deref or some interaction with <code>Pin</code>.</p>



<a name="205063277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205063277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205063277">(Jul 26 2020 at 19:00)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> chalk+polonius+etc, I think.</p>



<a name="205072842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205072842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205072842">(Jul 27 2020 at 00:05)</a>:</h4>
<p>Niko mentioned self-referential structs as a far-future possibility of Polonius in his Rust Belt Rust talk.</p>



<a name="205072962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205072962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205072962">(Jul 27 2020 at 00:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> That's where the idea came from.</p>



<a name="205074072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205074072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205074072">(Jul 27 2020 at 00:42)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span>  <a href="https://www.youtube.com/watch?reload=9&amp;v=_agDeiWek8w">https://www.youtube.com/watch?reload=9&amp;v=_agDeiWek8w</a> (cameo by yours truly)</p>
<div class="youtube-video message_inline_image"><a data-id="_agDeiWek8w" href="https://www.youtube.com/watch?reload=9&amp;v=_agDeiWek8w"><img src="https://i.ytimg.com/vi/_agDeiWek8w/default.jpg"></a></div>



<a name="205074111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205074111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205074111">(Jul 27 2020 at 00:42)</a>:</h4>
<p>wrong josh ;)</p>



<a name="205074115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205074115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205074115">(Jul 27 2020 at 00:42)</a>:</h4>
<p>but also wow what a great quote for polonius</p>



<a name="205074189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205074189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205074189">(Jul 27 2020 at 00:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement/near/205074111">said</a>:</p>
<blockquote>
<p>wrong josh ;)</p>
</blockquote>
<p><a href="/user_uploads/4715/geQH0LvlP2DMEgwa-5rFx0L3/image.png">image.png</a>  Zulip bug?</p>
<div class="message_inline_image"><a href="/user_uploads/4715/geQH0LvlP2DMEgwa-5rFx0L3/image.png" title="image.png"><img src="/user_uploads/4715/geQH0LvlP2DMEgwa-5rFx0L3/image.png"></a></div>



<a name="205074261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205074261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205074261">(Jul 27 2020 at 00:47)</a>:</h4>
<p>oh I didn't know people actually looked at emojis <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="205074265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review%20quick%20rental%20replacement/near/205074265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Review.20quick.20rental.20replacement.html#205074265">(Jul 27 2020 at 00:47)</a>:</h4>
<p>this is cool talk though, thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>